Sub Main ()
with metascript 

btwndt = " And billdate  between '" & local.dtfrom.tag & "' and '" & local.dtto.tag & "' "
st = "Select billno, billdate,Code, Name, GSTIN,  error from GIRN_Out  as o, salehead as h, customer as c " & _
" Where customerkey = customerid and h.billno = DocNo and  mystatus =0 " & BtwnDt
msgbox st
set rs = .sumrs(st & "", .getdatafile)

if not rs.eof then
   filename = local.getfilename("enter filename","xls")
local.dumprstoexcel rs,filename
msgbox "saved to " & filename
else
msgbox "Nothing found"
end if

end with 
End Sub






